home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mastering Microsoft Visual Basic 5
/
Mastering Microsoft Visual Basic 5.ISO
/
sampapps
/
event notification
/
form1.frm
next >
Wrap
Text File
|
1997-01-15
|
4KB
|
140 lines
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3015
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3015
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtInterval
Height = 375
Left = 2400
TabIndex = 3
Text = "500"
Top = 1260
Width = 855
End
Begin VB.CommandButton cmdStop
Caption = "Sto&p"
Height = 435
Index = 1
Left = 2520
TabIndex = 1
Top = 540
Width = 1335
End
Begin VB.CommandButton cmdStart
Caption = "&Start"
Height = 435
Index = 0
Left = 540
TabIndex = 0
Top = 540
Width = 1335
End
Begin VB.Image Image1
Height = 480
Index = 5
Left = 1980
Picture = "Form1.frx":0000
Top = 2100
Visible = 0 'False
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 4
Left = 1980
Picture = "Form1.frx":030A
Top = 2100
Visible = 0 'False
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 3
Left = 1980
Picture = "Form1.frx":074C
Top = 2100
Visible = 0 'False
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 2
Left = 1980
Picture = "Form1.frx":0B8E
Top = 2100
Visible = 0 'False
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 1
Left = 1980
Picture = "Form1.frx":0FD0
Top = 2100
Visible = 0 'False
Width = 480
End
Begin VB.Image Image1
Height = 480
Index = 0
Left = 1980
Picture = "Form1.frx":1412
Top = 2100
Width = 480
End
Begin VB.Label Label1
Caption = "&Interval(milliseconds):"
Height = 255
Left = 720
TabIndex = 2
Top = 1320
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents objNotify As Notifier
Dim idxCurrent As Long
Private Sub cmdStart_Click(Index As Integer)
' If the Notify object is not enabled, set the interval
' and enable it.
If Not objNotify.Enabled Then
objNotify.Interval = txtInterval
objNotify.Enabled = True
End If
End Sub
Private Sub cmdStop_Click(Index As Integer)
If objNotify.Enabled Then
objNotify.Enabled = False
End If
End Sub
Private Sub Form_Load()
' Create the Nofitier object
Set objNotify = New Notifier
idxCurrent = 0
End Sub
Private Sub objNotify_Alarm()
' As the alarm sounds, simply increment the index of the
' icon which is to be displayed.
Dim idxNext As Long
idxNext = idxCurrent + 1
If idxNext > 5 Then idxNext = 0
Image1(idxNext).Visible = True
Image1(idxCurrent).Visible = False
idxCurrent = idxNext
End Sub